import request from '@/utils/request.js'
import qs from 'uview-ui/libs/function/queryParams'
import { getUserInfo } from '@/utils/user'

/**
  * 获取学长学姐列表
  * @param {String} type 方向 1竞赛 2深造 3就业
  * @param {String} sortCode	筛选方式
  * @param {String} modChoiceCode 正序倒序
  * @param {Number} pageNum
  * @param {Number} pageSize
  */
export const getConsultUsers = (params) => request('/seniorInfo/getSeniorInfoPageable', 'GET', params)

/**
  * 获取学长学姐详细
  * @param {String} id
  */
export const getConsultUser = (id) => request('/seniorInfo/getSeniorInfoBySiId', 'GET', { siId: id })

/**
  * 获取学长学姐可咨询时间
  * @param {String} id
  */
export const getCanConsultTime = (id) => request(`/seniorConsult/getSeniorConsultTime/${ id }`, 'GET')

/**
  * 获取学长学姐可咨询时间
  * @param {String} id
  */
export const getLeisureTime = (id) => request(`/seniorConsult/getSeniorConsultTime/${ id }`, 'GET')

/**
  * 支付订单
  * @param {siUId} siId	学长学姐id
  * @param {Number} scpTimeCount 市场
  */
export const payOrder = (data) => request('/seniorConsult/paySeniorConsult', 'POST', data)

/**
  * 获取是否可评价学长学姐
  * @param {String} seniorId 学长学姐id
  */
export const getCanComment = (params) => request('/seniorAppraise/ifUserCanAppraise', 'GET', params)

/**
  * 获取学长学姐评价列表
  * @param {String} seniorid 学长学姐id
  * @param {Number} pageNum
  * @param {Number} pageSize
  */
export const getConsultComments = (params) => request('/seniorAppraise/getBySeniorId', 'GET', params)

/**
  * 发表评价
  * @param {Number} seniorId 学长学姐id
  * @param {String} appraise 评价内容
  * @param {Number} score 分数
  */
export const postComment = (data) => request('/seniorAppraise/appraise', 'POST', data)

/**
  * 获取咨询已经付款的订单列表
  * @param {Number} pageNum
  * @param {Number} pageSize
  */
export const getConsultOrders = (params) => request('/seniorConsult/me', 'GET', params)

/**
  * 获取咨询订单详情
  */
export const getConsultOrder = (orderId) => request(`/seniorManagement/getDetail/${ orderId }`, 'GET',)

/**
  * 获取咨询文件列表
  * @param {Number} payId 支付id
  */
export const getConsultFiles = (payId) => request(`/seniorProblem/selectProblemByPayId`, 'GET', { payId })

/**
  * 获取上传签名
  * @param {String} filename 文件名
  * @param {Number} payId 支付id
  */
export const getConsultFileSign = (params) => request(`/seniorProblem/getUpload`, 'GET', params)

/**
  * 附件插入数据库
  * @param {String} filename 文件名
  * @param {Number} payId 支付id
  * @param {String} url cos访问路径
  */
export const postConsultFile = (data) => request(`/seniorProblem/upload`, 'POST', data)

/**
  * 修改附件内容
  * @param {Number} fileId 附件id
  * @param {String} filename 文件名
  * @param {Number} payId 支付id
  * @param {String} url cos访问路径
  */
export const updateConsultFile = (data) => request(`/seniorProblem/update`, 'PUT', data)

/**
  * 删除附件内容
  * @param {Number} fileId 附件id
  */
export const delConsultFile = (fileId) => request(`/seniorProblem/deleteByFileId?fileId=${ fileId }`, 'DELETE',)

/**
 * 修改咨询问题
 * @param {Number}  scpId 支付订单id
 * @param {String}  scpConsult 问题
 */
export const updateConsultProblem = ({ scpId, ...data }) => request(`/seniorConsult/modifyScp/${ scpId }`, 'PUT', data)

/* 创建一个客服 */
// request(`/seniorManagement/newCustomerService${ qs({
//   scsName: 'Aha小助手',
//   scsQrcodeUrl: '/11111'
// }) }`, 'POST')
// request('/seniorManagement/getCustomerServicePageable?pageNum=1&pageSize=1', 'GET')
